#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<math.h>
int main() {
	long long c = 0;
	scanf("%lld", &c);
	int n = 0;
	for (long long  a = 1; a < c; a++) {
		long long b = sqrt(c * c - a * a);
			if (a * a + b * b == c * c) {
				n++;
			}
	}
	printf("%d", n/2);
	return 0;
}